package ControlLayer;
import ModelLayer.*;
import java.util.ArrayList;
//model layer package has to be imported

public class AddressCtr
{
    private AddressBook adBog;
    //declare instance variables to reference containers
    //passed as arguments from the main class
    //Address container is to be passed as parameter from the main controller
    public AddressCtr()
    {
        adBog = adBog.getSingleton();
    }
    
    //objects of class Person are to be returned, not String
    public Person getPerson(int id)
    {
        return adBog.getPerson(id);
        //this method is to search the container for a person
        //with an id-number equal to the parameter id
        //when person is found, the method is to call print-methods in the TUI layer
    }
    
    public void createPerson(int id, String name, String address, String postalCode, String city, String phoneNr)
    {
        Person person = new Person(id, name, address, postalCode, city, phoneNr);
        adBog.createPerson(person);
    }
    
    public void deletePerson(int id)
    {
        adBog.deletePerson(id);
        //search for the person and delete the object from the container
    }
    
    public void updatePerson(int id, String name, String address, String postalCode, String city, String phoneNr)
    {
        adBog.updatePerson(id, name, address, postalCode, city, phoneNr);
    }
    
    public ArrayList listAllPersons()
    {
          return null;
    }
}
